// LemCoop
// Copyright (C) 2013  Oliver Naumann <bldrax@gmail.com>

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef LEMC_CLIENTCONNECTION_H
#define LEMC_CLIENTCONNECTION_H

#include <string>

#include "../system/global.h"

/*
* Stores all important information that belongs to a client (e.g. its unique identifier and its name to be
* displayed). Note that the server itself it also just a 'client' in this sense, it has the same attributes
* as everybody else.
*/
class ClientConnection
{
private:
	// The unique identifier of a player.
	std::string m_guid;

	// The name if a player.
	std::string m_name;

	// Flags that define whether a client connection can control the Lems of a certain player.
	bool m_control[MAX_PLAYERS];

public:
	void set_guid(std::string id) { m_guid = id; }
	std::string guid() { return m_guid; }

	void set_name(std::string name) { m_name = name; }
	std::string name() { return m_name; }

	void set_control_at(int index, bool control) { if (index >= 0 && index < MAX_PLAYERS) m_control[index] = control; }
	bool control_at(int index) { if (index >= 0 && index < MAX_PLAYERS) return m_control[index]; else return false;} 
};

#endif